import { NoSkinCellRenderer } from "../../common/item/NoSkinCellRenderer";
import { SCrossGuildWarFinalRank } from "../../../../../Message/Public/SCrossGuildWarFinalRank";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { DisplayUtil } from "../../../../common/DisplayUtil";
import { CrossGuildWarUtil } from "../util/CrossGuildWarUtil";
import { EntityUtil } from "../../../scene/layer/utils/EntityUtil";
import { ItemData } from "../../../resource/info/ItemData";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
type int = number;
//class CrossGuildWarScheduleRankRender
    
    export  class CrossGuildWarScheduleRankRender extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            this._myData = arg1 as SCrossGuildWarFinalRank;
            if (this._myData.rank == 1 || this._myData.rank == 2) 
            {
                if (this._bmpHand == null) 
                {
                    this._bmpHand = ObjCreate.createBitmap(ImagesConst.RangeAdore, 14, 12, this);
                }
            }
            else 
            {
                DisplayUtil.removeMe(this._bmpHand);
            }
            this._txtRank.htmlText = CrossGuildWarUtil.getRankHtmlName(this._myData.rank);
            this._txtServer.text = EntityUtil.getProxyName(this._myData.guildId);
            this._txtGuildName.text = this._myData.guildName;
            this._txtHonor.text = CrossGuildWarUtil.getRewardHonor(this._myData.rank).toString();
            this._txtReward.htmlText = new ItemData(CrossGuildWarUtil.getRewardCode(this._myData.rank)).htmlName;
            if (CrossGuildWarUtil.isOurGuild(this._myData.guildName, this._myData.guildId.id)) 
            {
                if (this._selectedBg == null) 
                {
                    this._selectedBg = ObjCreate.createBg(0, 0, 788, 42, null, ImagesConst.SelectedBg);
                }
                this.addChildAt(this._selectedBg, 0);
            }
            else if (this._selectedBg != null) 
            {
                DisplayUtil.removeMe(this._selectedBg);
            }
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            var loc1=GlobalStyle.textFormat1;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._txtRank = ObjCreate.createGTextField("", 0, this.txtY, 128, 20, this, loc1);
            this._txtServer = ObjCreate.createGTextField("", 0, this.txtY, 417, 20, this, loc1);
            this._txtGuildName = ObjCreate.createGTextField("", 247, this.txtY, 290, 20, this, loc1);
            this._txtHonor = ObjCreate.createGTextField("", 437, this.txtY, 240, 20, this, loc1);
            this._txtReward = ObjCreate.createGTextField("", 645, this.txtY, 158, 20, this, loc1);
            ObjCreate.createBg(10, 42, 785, 1, this, ImagesConst.SplitLine);
            return;
        }

        /* internal */ /* const */txtY: int=15;

        /* internal */ /* var */_txtRank: GTextFiled;

        /* internal */ /* var */_txtServer: GTextFiled;

        /* internal */ /* var */_txtGuildName: GTextFiled;

        /* internal */ /* var */_txtHonor: GTextFiled;

        /* internal */ /* var */_txtReward: GTextFiled;

        /* internal */ /* var */_bmpHand: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_selectedBg: ScaleBitmap;

        /* internal */ /* var */_myData: SCrossGuildWarFinalRank;
    }
